package com.tbit.config.mvc.converter;

import com.tbit.uqbike.enums.TagStatus;
import org.springframework.core.convert.converter.Converter;


/**
 * TagStatus 转换器
 * String -> TagStatus
 *
 *
 * @author <a href="mailto:chen.chaoxiong@tbit.com.cn">ChenChaoXiong</a>
 * @since 2024/7/10
 */
public class StringToTagStatusConverter implements Converter<String, TagStatus>{
    @Override
    public TagStatus convert(String source) {
        TagStatus status = TagStatus.getTagStatusByCode(source);
        if (status == null) {
            throw new IllegalArgumentException("Invalid TagStatus code: " + source);
        }
        return status;
    }
}
